﻿namespace Arbalest.Models
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;

    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    /// 
    [Serializable]
    public class Alert
    {
        public enum AlertContext
        {
            None, 
            Error, 
            Success,
            Info
        }

        public AlertContext Context
        {
            get;
            set;
        }

        public string Markup
        {
            get;
            set;
        }

        #region constructors
        
        public Alert() :
            this(AlertContext.None, string.Empty)
        {
        }

        public Alert(AlertContext alertContext, string markup) 
        {
            this.Context = alertContext;
            this.Markup = markup;
        }

        #endregion constructors

        public string GetAlertCss()
        {
            string css = string.Empty;

            switch (this.Context)
            {
                case AlertContext.Error:
                    css = "alert-error";
                    break;
                case AlertContext.Info:
                    css = "alert-info";
                    break;
                case AlertContext.Success:
                    css = "alert-success";
                    break;
                case AlertContext.None:
                default:
                    break;
            }

            return css;
        }

        public string GetAlertHeader()
        {
            string headerText = string.Empty;

            switch (this.Context)
            {
                case AlertContext.Error:
                    headerText = "Error";
                    break;
                case AlertContext.Info:
                    headerText = "Information";
                    break;
                case AlertContext.Success:
                    headerText = "Success";
                    break;
                case AlertContext.None:
                default:
                    break;
            }

            return headerText;
        }
    }
}